#!/usr/bin/env/ pythonBasics
# -*-coding:utf-8 -*-

# Author:super

import  yaml
from common.apiMethod import *
import json


class OpenYamlFile:
	def readYaml(self,fileDir,fileName):
		'''
		获取文件返回一个list集合
		:param fileDir: 文件目录
		:param fileName: 文件名称
		:return: list集合
		'''
		with open(filePath(fileDir=fileDir,fileName=fileName),'r',encoding='utf-8') as f:
			return list(yaml.safe_load_all(f))

	def dictYaml(self,fileDir,fileName):
		'''获取文件，返回一个字典'''
		with open(filePath(fileDir=fileDir,fileName=fileName),'r',encoding='utf-8') as f:
			return yaml.safe_load(f)

if __name__ == '__main__':
	obj=OpenYamlFile()
	print(json.dumps(obj.readYaml('data','login.yaml'),indent=True))